﻿using STHPMS1.BLL.B_Core;
using STHPMS1.ICore.I_BLL.Bus;
using STHPMS1.ICore.I_Entity.Info;
using STHPMS1.ICore.I_Entity.Stmpms1;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using STHPMS1.Common.C_Entity.Stmpms1;
using System.Linq;
using System.Collections;
using STHPMS1.ICore.I_DAL;
using STHPMS1.ICore.I_Serv;
using STHPMS1.ICore;


namespace STHPMS1.BLL.B_Bus
{
    public class Df_Costmod_ParaBus : BllBase, IDf_Costmod_ParaBill
    {
        public void Save<T>(T entity)
            where T : class ,IDf_Costmod_Para
        {
            if (this.Scene.Dal.Sthpms1.Update(entity) == 0)
            {
                this.Scene.Dal.Sthpms1.Insert(entity);
            }
        }

        public void Remove(IDf_Costmod_Para entity)
        {
            this.Scene.Dal.Sthpms1.Delete(entity);
        }

        public IEnumerable<T> Get<T>(Expression<Func<T, bool>> predicate, IPagingInfo info)
            where T : class, IDf_Costmod_Para
        {
            return this.Scene.Dal.Sthpms1.Select<T>(predicate, info);
        }

        /// <summary>
        /// 获取资金模型参数信息类
        /// </summary>
        /// <param name="anniname">资金模型名称</param>
        /// <returns></returns>
        public IDf_Costmod_Para GetCostmod_Para(string anniname)
        {
            ISthpms1Dao dao = this.Scene.Dal.Sthpms1;
            return dao.Single<Df_Costmod_Para>(p => p.Anni_Name == anniname);
        }


        /// <summary>
        /// 获取资金模型名称
        /// </summary>
        /// <param name="annutype">分析类型</param>
        /// <returns></returns>
        public List<string> GetAnniName(string annutype)
        {
            return this.Scene.Dal.Sthpms1.Df_Costmod_Para.GetAnniName(annutype);
        }

        /// <summary>
        /// 获取资金模型名称下所有分析年度
        /// </summary>
        /// <param name="anni_name"></param>
        /// <returns></returns>
        public List<string> GetAnaly_Year(string anni_name)
        {
            return this.Scene.Dal.Sthpms1.Df_Costmod_Para.GetAnaly_Year(anni_name);
        }

    }
}
